package com.dkha.task;

import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
import com.dkha.task.config.MyMetaObjectHandler;
import com.dkha.task.service.WebSocketContral;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
 * @version V1.0
 * @Description: TODO(please write your description)
 * All rights 成都电科慧安
 * @Title: FaceSnapShotMain
 * @Package com.dkha.face.contral
 * @author: panhui
 * @date: 2019/12/25 10:09
 * @Copyright: 成都电科慧安
 */
@EnableSwagger2
@SpringBootApplication(scanBasePackages = {"com.dkha.common","com.dkha.task"})
@MapperScan("com.dkha.task.modual.mapper")
@EnableScheduling
@EnableAsync
public class FaceTaskMain {

    public static void main(String[]args)
    {
        SpringApplication springApplication = new SpringApplication(FaceTaskMain.class);
        ConfigurableApplicationContext configurableApplicationContext = springApplication.run(args);
        //解决WebSocket不能注入的问题
        WebSocketContral.setApplicationContext(configurableApplicationContext);
    }

    /**
     * mybatis-plus自动注入插件
     *
     * @return
     */
    @Bean
    public MyMetaObjectHandler createMyMetaObjectHandler() {
        return new MyMetaObjectHandler();
    }

    /**
     * mybatis-plus执行效率插件
     * @return
     */
    //@Bean
    // 设置 dev test 环境开启
    //@Profile({"dev"})
    public PerformanceInterceptor performanceInterceptor() {
        return new PerformanceInterceptor();
    }


}
